package org.wdj.rocketconsumer;

import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import org.slf4j.Logger;

//consume group 需要符合 /^[%|a-zA-Z0-9_-]+$/
@Service
@RocketMQMessageListener(topic = "${boot.rocketmq.topic}", consumerGroup = "string-consumer", selectorExpression = "${boot.rocketmq.tag}")
public class StringConsumer implements RocketMQListener<String> {
    private Logger logger = LoggerFactory.getLogger(getClass());

    @Override
    public void onMessage(String message) {
        logger.info("##### consumer received: {} \n", message);
    }
}
